package InnerClass;

/**
 * 1.成员内部类(实例内部类)
 */
public class TestClass {
    public static void main(String[] args) {
        Outer outer = new Outer();
//        Outer.Inner in = new Outer.Inner();
    Outer.Inner in = outer.new Inner();
        System.out.println(in.b);//20
        in.m2();
    }
}
//类级别,对象级别
class Outer{
 private    int a =10;//外部类实例变量
    //实例方法
    public void m1(){

    }
    //成员内部类(实例层级)
    class Inner{
        int a =20;//内部类实例变量
   // static     int b=20;
        int b=20;
        public void m2(){
            //内部类访问外部类实例变量
            System.out.println(Outer.this.a);//10
            System.out.println(a);//20
            System.out.println(b);//20
            System.out.println("Class inner m2()");
        }
    }
}
